<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!DOCTYPE html>
    <html lang="en">

    <head>
        <title>Hello World</title>
    </head>

    <body>
        <div id="root"></div>
        <script src="./sdk/react.development.js"></script>
        <script src="./sdk/react-dom.development.js"></script>
        <script src="./sdk/babel.min.js"></script>
        <script type="text/babel">
            // 用for循环渲染
            // 用array.map()来渲染 推荐使用第二种循环
            class List2 extends React.Component {
                books = ['vue', 'react', 'angular']
                render() {
                    // map(function(item, index){})  返回值是一个数组

                    // <ul>
                    // <li v-for="(item,index) in books" :key="index">{{item}}</li>
                    // </ul>
                    
                    return <div>
                        {this.books.map((item, index) => {
                            return <h1 key={index}>{item}</h1>
                        })} </div>
                }
            }

            ReactDOM.render(
                <List2 />,
                document.getElementById('root')
            );
        </script>
    </body>

    </html>
</body>

</html>